package StudyCode.summary.zipfile;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CopyingInputStreamFile {
	public static void main(String[] args) throws Exception {
		Path copy_from = Paths.get("E:/Copy/", "2.txt");
		Path copy_to = Paths.get("E:/Copy/", "1.txt");

		try (InputStream is = new FileInputStream(copy_from.toFile())) {
			Files.copy(is, copy_to, StandardCopyOption.REPLACE_EXISTING);
			System.out.println("从输入流( InputStream)复制到文件成功");
		} catch (IOException e) {
			System.err.println(e);
		}

	}
}
